﻿<div class="tabbable">
    <ul class="nav nav-tabs" id="myTab">
        <li class="active">
            <a data-toggle="tab" href="#tab1">
                基本设置
            </a>
        </li>

        <li class="tab-red">
            <a data-toggle="tab" href="#tab2">
                系统状态
            </a>
        </li>
    </ul>

    <div class="tab-content">
        <div id="tab1" class="tab-pane active">
            <form class="form">
                <div class="form-group clearfix form-bordered">
	                <label class="control-label col-md-1">系统名称</label>
	                <div class="col-md-11">
		                <input type="text" id="name" class="form-control" placeholder="系统名称" value="<?=$siteinfo->name?>">
	                </div>
                </div>
                <div class="form-group clearfix form-bordered">
	                <label class="control-label col-md-1">SEO关键字</label>
	                <div class="col-md-11">
		                <input type="text" id="seo_key" class="form-control" placeholder="SEO关键字" value="<?=$siteinfo->seo_key?>">
	                </div>
                </div>
                <div class="form-group clearfix form-bordered">
	                <label class="control-label col-md-1">SEO描述</label>
	                <div class="col-md-11">
		                <input type="text" id="seo_des" class="form-control" placeholder="SEO描述" value="<?=$siteinfo->seo_des?>">
	                </div>
                </div>
                <div class="form-group clearfix form-bordered">
	                <label class="control-label col-md-1">ICP备案号</label>
	                <div class="col-md-11">
		                <input type="text" id="icp" class="form-control" placeholder="ICP备案号" value="<?=$siteinfo->icp?>">
	                </div>
                </div>
                <div class="form-group clearfix form-bordered">
	                <label class="control-label col-md-1">版权信息</label>
	                <div class="col-md-11">
		                <script  type="text/plain" id="copyright"></script>
	                </div>
                </div>
                <div class="form-group clearfix form-bordered">
	                <label class="control-label col-md-1">统计代码</label>
	                <div class="col-md-11">
		                <textarea class="form-control col-md-11" id="count_code" placeholder="统计代码" rows="4"><?=$siteinfo->count_code?></textarea>
	                </div>
                </div>
                <div class="form-group text-right clearfix">
	                <button class="btn btn-success" id="save_site" type="button">保存</button>
	                <button class="btn btn-default" id="cancel_save_site" type="button">取消</button>
                </div>
            </form>
        </div>

        <div id="tab2" class="tab-pane">
            <div class="form-group">
                <label class="control-label col-md-1">系统状态</label>
                <div class="col-md-11">
	                <div class="radio">
		                <label>
			                <input name="site_status" type="radio" class="colored-success" <?php if($siteinfo->is_open == 1) echo 'checked';?>>
			                <span class="text">开放 （前后台完全开放）</span>
		                </label>
	                </div>

	                <div class="radio">
		                <label>
			                <input name="site_status" type="radio" class="colored-danger" <?php if($siteinfo->is_open == 0) echo 'checked';?>>
			                <span class="text">关闭 （只有超级管理员可以登录后台）</span>
		                </label>
	                </div>

	                <div class="radio">
		                <label>
			                <input name="site_status" type="radio" class="colored-warning"  <?php if($siteinfo->is_open == 2) echo 'checked';?>>
			                <span class="text">内部开放 （只对管理员用户开放）</span>
		                </label>
	                </div>

                </div>
            </div>
            <div class="form-group clearfix form-bordered">
                <label class="control-label col-md-1">默认密码</label>
                <div class="col-md-11">
	                <input type="text" name="default_pwd" class="form-control" placeholder="默认密码" value="<?=$siteinfo->default_password?>">
	                <span class="help-block">重置用户密码时的默认密码</span>
                </div>
            </div>
            <div class="form-group clearfix form-bordered">
                <label class="control-label col-md-1">上传路径</label>
                <div class="col-md-11">
	                <input type="text" name="upfile_path" class="form-control" placeholder="默认上传路径" value="<?=$siteinfo->upfile_path?>">
	                <span class="help-block">上传文件时的存放路径</span>
                </div>
            </div>

            <div class="clearfix"></div>
        </div>

    </div>
</div>
<!--Ueditor-->
<script src="<?=$tpl_dir?>assets/ueditor/ueditor.config.js"></script>
<script src="<?=$tpl_dir?>assets/ueditor/ueditor.all.js"></script>
<script>
	window.UEDITOR_HOME_URL = "<?=$tpl_dir?>assets/ueditor/";

		var ue = UE.getEditor('copyright');
		ue.ready(function() {
			//设置编辑器的内容
			ue.setContent('<?=$siteinfo->copyright;?>');

		});
		// console.log( ue.hasContents() );

		$("#save_site").click( function(){
			$.post(
				"<?=site_url( 'setting/save_site' )?>",
				{
					id:"<?=$siteinfo->id?>",
					name:$('#name').val(),
					seo_key:$('#seo_key').val(),
					seo_des:$('#seo_des').val(),
					icp:$('#icp').val(),
					copyright:ue.getContent(),
					count_code:$('#count_code').val(),
				},
				function( json ){
				    error_clear();
				    data = eval( '(' + json + ')' );
				    if( data.status == 'error' ){
					    error( 'warning', data.error );
				    }else{
					    error( 'success', data.error );
					    window.location.reload;
				    }
			    }
			);
		});
</script>

